// 部门/任务
import { defineStore } from 'pinia'
import { storage } from '../utils'
export default defineStore('legalTypeStore', {
  state: () => ({
    legalType: [] as any[],
  }),
  actions: {
    loadState() {
      const data = storage.get('LEGAL_TYPE', '[]');
      this.$patch({ legalType: JSON.parse(data) });
    },

    setAllState(newState: Partial<any[]>) {
      storage.set('LEGAL_TYPE', JSON.stringify(newState))
      this.$patch({ legalType: newState });
    },
    getAllState(): any[] {
      this.loadState();
      return this.legalType;
    },
  },
})
